package notebook.shared;

import java.util.HashMap;

public class DTOUtil {
	//from string: "key,value><key1,value1><key2,value2" to map
	public static HashMap<String,String> fromStringToMap(String keywordStr){
		HashMap<String,String> keywordMap = new HashMap<String,String>();
		String[] keywordStringSplited = keywordStr.split("><");
		if(keywordStringSplited.length > 0){
			for(String k:keywordStringSplited){
				String[] keyPair = k.split(",");
				if(keyPair.length>1)
					keywordMap.put(keyPair[0], keyPair[1]);
				else
					keywordMap.put(keyPair[0], null);
			}
		}
		return keywordMap;
	}
}
